import React, { Component } from 'react';
import { Row, Col } from 'antd';
import G2 from '@antv/g2';
import Pie from '../Pie';

class PieGroup extends Component {
  render() {
    const { data, height } = this.props;
    const column = 24 / data.length;
    const { colors } = G2.Global;
    return (
      <Row gutter={4}>
        {
          data.map((child, i) => {
            const { sId } = child;
            child.height = height;
            child.color = colors[i];
            return (
              <Col span={column} key={sId}>
                <Pie {...child} />
              </Col>
            );
          })
        }
      </Row>
    );
  }
}

export default PieGroup;

